<template>
  <div>
    <ZgEdit
      ref="dialog"
      :view="{ width: '60%', top: '5%', title: '修改数据' }"
      :columns="columns"
      :formulas="formulas"
      validUrl=""
      saveUrl="">
    </ZgEdit>
  </div>
</template>
<script>
export default {
  data () {
    return {
      columns: [
        { name: '头像', code: 'head', compType: '图片', isNeed: true, offset: 0, span: 24, defaultVal: '' },
        { name: '性别', code: 'sex', compType: '字典', isNeed: true, offset: 0, span: 24, defaultVal: '1', extra: { 字典类型: 'sex' } },
        { name: '姓名', code: 'name', compType: '单行文本', isNeed: true, offset: 0, span: 24, defaultVal: 'zxb', regex: '', errorMsg: '' },
        { name: '简介', code: 'intro', compType: '多行文本', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 行数: 3 } },
        { name: '个人经历', code: 'info', compType: '富文本', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 高度: 400 } },
        { name: '年龄', code: 'age', compType: '整数', isNeed: true, offset: 0, span: 24, defaultVal: 0 },
        { name: '分数', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 24, defaultVal: 0 },
        { name: '是否测试账号', code: 'is_test', compType: '单选框', isNeed: true, offset: 0, span: 24, defaultVal: false },
        { name: '政治面貌', code: 'political', compType: '多选', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 字典类型: 'political' } },
        { name: '是否启用', code: 'is_use', compType: '开关', isNeed: true, offset: 0, span: 24, defaultVal: false },
        { name: '生日', code: 'birth', compType: '日期', isNeed: true, offset: 0, span: 24, defaultVal: '2025-05-22' },
        { name: '最后登录时间', code: 'last_login_time', compType: '日期时间', isNeed: true, offset: 0, span: 24, defaultVal: '2025-05-22 12:00:00' }
      ],
      formulas: [
        { triggerMode: '初始化时', name: '公式1', content: 'console.log("init");' },
        { triggerMode: '数据变化时', name: '公式2', content: 'console.log("update");' },
        { triggerMode: '提交时', name: '公式3', content: 'console.log("submit");' }
      ]
    }
  },
  methods: {
    open (json) {
      this.$refs.dialog.open(json)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
